///////////////////////////////////////////////////////////////////////////////
//	FILENAME:	EBI.m
//	SUMMARY:	an Eight-Ball (TM) Infopanel
//	SUPERCLASS:	Object
//	INTERFACE:	None
//	PROTOCOLS:	<Inspectable>
//	AUTHOR:		Rohit Khare
//	COPYRIGHT:	(c) 1994 California Institure of Technology, eText Project
///////////////////////////////////////////////////////////////////////////////
//	DESCRIPTION
//		Stupid infopanel container
///////////////////////////////////////////////////////////////////////////////
//	HISTORY
//	10/31/94:	Converted to eText5; modified inspector protocol
//	05/22/94:	Created. First eText port.
///////////////////////////////////////////////////////////////////////////////
#import "../eTextKernel.h"
@interface EightBawl:Object <Annotation, Tool>
{	BOOL	highlighted;
	int		animStep;
	id		cimage;
	NXRect  savedFrame;
	NXPoint savedPoint;
}
@end
@interface EBI:Object <Inspectable>
{
	id infoPanel;
	id infoView;
}
+new;
@end

@implementation EBI
// Insurance policy for bundle principal-class ordering
+ toolAwake:theApp {return [EightBawl toolAwake:theApp];}

#define	INFO	"Info"

+ new
{
	static EBI *ebi = nil;
	
	if (!ebi) {
		ebi = [[EBI alloc] init];
	}
	return ebi;
}
- free {return self;}
- init
{
	char        buf[MAXPATHLEN];
	NXBundle   *bundle;
	
	[super init];
	bundle = [NXBundle bundleForClass:[EBI class]];
	if ( [bundle getPath:buf forResource:"8Bawl" ofType:"nib"] ) {
		[NXApp loadNibFile:buf owner:self withNames:NO];
	} else {
		NXLogError("NIB not found: 8Bawl");
	}
	infoView = [infoPanel contentView];
	return self;
}
- (const NXAtom *) types
{
	static NXAtom types[2] = {NULL, NULL};
	
	if (!types[0]) {
		types[0] = NXUniqueString(INFO);
	}
	return types;
}

- (const char *) inspectorTitle
{
	return NXUniqueString("8Bawl");
}

- resignInspector: (View *) oldInspector ofType: (const char *) type 
{
	return self;
}

- activateInspector: (View *) newInspector ofType: (const char *) type 
{
	return self;
}

- inspectorForType:(const char *) type 
{
	if(!strcmp(type,INFO))
		return infoView;
	else NXLogError("Massive Inspector Failure: Asked EBI for: %s", type);
	return infoView;
}
@end